package ar.com.e2solver.solver;

import java.util.ArrayList;
import java.util.List;

public final class RandomSelector {
	
	private RandomSelector(){}

	public static List<Individual> select(Population population, int numberOfSelections) {
		List<Individual> selectionCandidates = new ArrayList<Individual>(population.getIndividuals());
		List<Individual> selection = new ArrayList<Individual>();
		
		int random = 0;
		for (int i = 0; i < numberOfSelections; i++) {
			random = RandomConstants.RANDOM.nextInt(selectionCandidates.size());
			selection.add(selectionCandidates.remove(random));
		}
		
		return selection;
	}

}
